<div class="layui-card-header layui-card">
    <span class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">首页</a>
        <a>用户管理</a>
        <a><cite>资源详情</cite></a>
    </span>
</div>
<style>
    .layui-form-label {
        width:15% !important;
        margin-left:1%;
    }
    .layui-input-inline {
        width: 33% !important;
    }
</style>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-tab layui-tab-brief">
            <ul class="layui-tab-title">
                <li class="layui-this">资源详情</li>
            </ul>
            <div class="layui-tab-content">
                <form class="layui-form layui-form-pane" id="layuiadmin-app-form-list">
                    <div class="layui-form-item">
                        <label class="layui-form-label">资源ID</label>
                        <div class="layui-input-inline">
                            <input type="text" id="resourceId" name="resourceId" disabled="disabled" class="layui-input">
                        </div>
                        <label class="layui-form-label">父资源ID</label>
                        <div class="layui-input-inline">
                            <input type="text" id="parentId" name="parentId" disabled="disabled" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">资源名称</label>
                        <div class="layui-input-inline">
                            <input type="text" id="name" name="name" disabled="disabled" autocomplete="off" class="layui-input">
                        </div>
                        <label class="layui-form-label">资源标题</label>
                        <div class="layui-input-inline">
                            <input type="text" id="title" name="title" disabled="disabled" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">跳转URL</label>
                        <div class="layui-input-inline">
                            <input type="text" id="jump" name="jump" disabled="disabled" autocomplete="off" class="layui-input">
                        </div>
                        <label class="layui-form-label">授权名</label>
                        <div class="layui-input-inline">
                            <input type="text" id="permName" name="permName" disabled="disabled" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">授权URL</label>
                        <div class="layui-input-inline">
                            <input type="text" id="permUrl" name="permUrl" disabled="disabled" autocomplete="off" class="layui-input">
                        </div>
                        <label class="layui-form-label">资源类型</label>
                        <div class="layui-input-inline">
                            <input type="text" id="kind" name="kind" disabled="disabled" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">所属系统</label>
                        <div class="layui-input-inline">
                            <input type="text" id="systemType" name="systemType" disabled="disabled" autocomplete="off" class="layui-input">
                        </div>
                        <label class="layui-form-label">菜单图标</label>
                        <div class="layui-input-inline">
                            <input type="text" id="icon" name="icon" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">排序值</label>
                        <div class="layui-input-inline">
                            <input type="text" id="orderNum" name="orderNum" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block" style="margin-left: 12px">
                            <a class="layui-btn backBtn" onclick="back()">返回</a>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['table','util','admin', 'form'], function() {
        var table = layui.table
            ,$ = layui.$
            ,form = layui.form
            ,admin = layui.admin
            ,element = layui.element;

        element.render('breadcrumb', 'breadcrumb'); // 渲染导航信息

        var resourceId = layui.router().search.resourceId;
        admin.req({
            type: 'get',
            url: layui.setter.baseUrl + '/sys/resource/get',
            data: {
                resourceId : resourceId
            },
            error: function(err){
                layer.alert(JSON.stringify(err.field), {
                    title: '错误提示'
                })
            },
            success: function(res) {
                if (res.code == 0) {
                    $('#parentId').val(res.data.parentId);
                    $('#resourceId').val(res.data.resourceId);
                    $('#name').val(res.data.name);
                    $('#title').val(res.data.title);
                    $('#jump').val(res.data.jump);
                    $('#icon').val(res.data.icon);
                    $('#orderNum').val(res.data.orderNum);
                    $('#permName').val(res.data.permName);
                    $('#permUrl').val(res.data.permUrl);
                    $('#systemType').val(res.data.systemType == 1 ? '运营平台' : res.data.systemType == 2 ? "商户系统" : res.data.systemType == 3 ? "代理商系统" : "错误操作");
                    $('#kind').val(res.data.kind == 1 ? "菜单" : "按钮");
                }
            }
        })
    })

    function back(){
        location.href = layui.setter.baseLocal + "sys/resource/index";
    }
</script>